package main

import (
	"encoding/json"
	"fmt"
)

type Person struct {
	Name string `json:"name"`
	Age  int
}

func main() {
	person := Person{"xiaobai", 5}
	fmt.Println("person:", person)
	if b, err := json.Marshal(person); err != nil {
		fmt.Printf("error:%s", err.Error())

	} else {
		fmt.Printf("value:%s", b)
	}
}
